function init() {
	// validate amount box

	//$('new_item').style.display = 'block'; // reveal the new item button if js is enabled

	// get rid of non-js version and overwrite with js version
	//datePickerString = '<label>' + lang_invoice_date_issued + '<input type="hidden" name="dateIssued" id="dateIssued" value="' + datePicker1 + '"/></label><span id="dateIssuedDisplay">' + datePicker2 + '</span> <a href="#" id="changeDate" onclick="Effect.toggle (\'cal1Container\', \'Blind\', {duration:0.4});return false;">' + lang_invoice_change + '</a>';
	//$('dateIssuedContainer').innerHTML =  datePickerString;
	
	//recalculate_items();

	item_count = $$('#item_area .item_row').length;
}


//item_count = 1; // currently 1 itemized item






function create_itemized_fields() { 
	
	item_count++; 
var row = document.createElement("tr"); 
	row.setAttribute("id", "item" + item_count); 


var td = document.createElement("td"); 
var theInput = document.createElement("input"); 
	theInput.setAttribute("type", "text"); 
	theInput.setAttribute("name", "items[" + item_count + "][type]"); 
	theInput.setAttribute("size", "4"); 
        td.appendChild(theInput);	
	row.appendChild(td); 


	var td = document.createElement("td"); 
var theInput = document.createElement("input"); 
	theInput.setAttribute("type", "text"); 
	theInput.setAttribute("name", "items[" + item_count + "][item_number]"); 
	theInput.setAttribute("size", "40"); 
        td.appendChild(theInput);	
	row.appendChild(td); 

	var td = document.createElement("td"); 
var theInput = document.createElement("input"); 
	theInput.setAttribute("type", "text"); 
	theInput.setAttribute("name", "items[" + item_count + "][quantity]"); 
	theInput.setAttribute("size", "8"); 
        td.appendChild(theInput);	
	row.appendChild(td); 

	var td = document.createElement("td"); 
var theInput = document.createElement("input"); 
	theInput.setAttribute("type", "text"); 
	theInput.setAttribute("name", "items[" + item_count + "][unit]"); 
	theInput.setAttribute("size", "4"); 
        td.appendChild(theInput);	
	row.appendChild(td); 

	var td = document.createElement("td"); 
var theInput = document.createElement("input"); 
	theInput.setAttribute("type", "text"); 
	theInput.setAttribute("name", "items[" + item_count + "][amount]"); 
	theInput.setAttribute("size", "7"); 
	theInput.setAttribute("value", "0.00");
        td.appendChild(theInput);	
	row.appendChild(td); 

	var td = document.createElement("td"); 
var theInput = document.createElement("input"); 
	theInput.setAttribute("type", "text"); 
	theInput.setAttribute("name", "items[" + item_count + "][currency]"); 
	theInput.setAttribute("size", "4"); 
        td.appendChild(theInput);	
	row.appendChild(td); 

	var td = document.createElement("td"); 
var theInput = document.createElement("input"); 
	theInput.setAttribute("type", "text"); 
	theInput.setAttribute("name", "items[" + item_count + "][lead_time]"); 
	theInput.setAttribute("size", "5"); 
        td.appendChild(theInput);	
	row.appendChild(td); 





var td = document.createElement("td");  
var img = document.createElement("img"); 
	img.setAttribute("alt", "remove row"); 
	img.setAttribute("src", base_url_no_index + "img/cancel.png"); 
	img.setAttribute("onclick", "$(\"item_area\").removeChild($(\"item" + item_count + "\"));"); 
	 
	td.appendChild(img); 
	row.appendChild(td); 

//var row2 = document.createElement("tr"); 
//	row2.setAttribute("id", "item" + item_count + "note"); 
//var td = document.createElement("td"); 
//	td.setAttribute("colspan", "4");

//var theTextarea = document.createElement("textarea"); 
//	theTextarea.setAttribute("name", "items[" + item_count + "][note]"); 
//	theTextarea.setAttribute("rows", "5"); 
//	theTextarea.setAttribute("cols", "50"); 


//	td.appendChild(theTextarea); 
//	row2.appendChild(td); 


$("item_area").appendChild(row);
//$("item_area").appendChild(row2);


return false; }




addEvent(window,'load', init);
